#ifndef MEMORYHELPER_H
#define MEMORYHELPER_H

#include "Pixel.h"

class MemoryHelper
{
public:
    //static void Deallcoate(Pixel** pixels, int width, int height);
    //static Pixel** Allocate(int width, int height);

    template<class T>
    static T** Allocate2D(int width, int height)
    {
        if(width == 0 || height == 0)
            return NULL;

        T** arr = new T*[height];

        for(int h = 0; h < height; h++)
        {
            arr[h] = new T[width];
        }

        return arr;
    }

    template<class T>
    static void Deallocate2D(T** arr, int height)
    {
        if(arr == NULL || height == 0)
            return;

        for(int h = 0; h < height; h++)
        {
            delete[] arr[h];
        }

        delete[] arr;
    }
};

#endif // MEMORYHELPER_H